//完全数计算


#include <iostream>
using namespace std;

bool checkPerNum(int n)
{
    int sum = 0;
    for(int i = 1; i < n; i++)
    {
        if(n%i == 0) sum += i;
    }
    return sum == n;
}
int main() 
{
    int n = 0;
    cin >> n;
    int count = 0;
    for(int i = 1; i <= n; i++)
    {
        if(checkPerNum(i)) count++;
    }
    cout << count << endl;

    return 0;
}